package com.yimils.core.goods.config;


import lombok.AllArgsConstructor;
import lombok.Getter;

public interface GoodsConstant {
    @Getter
    @AllArgsConstructor
    enum GoodsAuditState {
        WAIT("wait", "等待审核"),
        PASS("pass", "通过审核"),
        NOTPASS("notpass", "未通过审核");
        private String code;
        private String name;


        public static String getTypeName(String code) {
            for (GoodsAuditState goodsAuditState : GoodsAuditState.values()) {
                if (goodsAuditState.getCode().contains(code)) {
                    return goodsAuditState.getName();
                }
            }
            return null;
        }

        public static String getTypeCode(String code) {
            for (GoodsAuditState goodsAuditState : GoodsAuditState.values()) {
                if (goodsAuditState.getCode().contains(code)) {
                    return goodsAuditState.getCode();
                }
            }
            return null;
        }
    }
    @Getter
    @AllArgsConstructor
    enum GoodsPutawayState {
        PUTAWAY("putaway", "上架"),
        SOLDOUT("soldout", "下架");
        private String code;
        private String name;


        public static String getTypeName(String code) {
            for (GoodsPutawayState goodsPutawayState : GoodsPutawayState.values()) {
                if (goodsPutawayState.getCode().contains(code)) {
                    return goodsPutawayState.getName();
                }
            }
            return null;
        }

        public static String getTypeCode(String code) {
            for (GoodsPutawayState goodsPutawayState : GoodsPutawayState.values()) {
                if (goodsPutawayState.getCode().contains(code)) {
                    return goodsPutawayState.getCode();
                }
            }
            return null;
        }
    }
}
